#pragma once

#include "IMultiChannelSpectrometer.h"
#include "ConnectionInfo.h"
#include "GlobalDef.h"
#include "ChannelStatus.h"

// Doxygen index page
/*! \mainpage Ideaoptics.NET.MultiChannel.SDK.CLR
 *
 * \section intro_sec 简介
 *
 * 本文档提供C++多通道光谱仪SDK的接口说明
 *
 * 详见 \ref Ideaoptics "Ideaoptics命名空间"
 */
namespace Ideaoptics
{
	/// <summary>
	/// 分配一条光谱数据的内存
	/// </summary>
	/// <para>分配的内存在使用完成后必须通过\ref SpectrumData_Del "SpectrumData_Del()"释放</para>
	/// <param name="size">像素数</param>
	/// <returns>分配好的光谱数据</returns>
	ExternC IDEAOPTICS_DLL SpectrumDataClr* SpectrumData_New(size_t size);
	/// <summary>
	/// 释放一个通过\ref SpectrumData_New "SpectrumData_New()"接口分配的光谱数据的内存
	/// </summary>
	/// <param name="spec">需要释放的光谱数据</param>
	/// <returns>无</returns>
	ExternC IDEAOPTICS_DLL void SpectrumData_Del(SpectrumDataClr* spec);

	/// <summary>
	/// 分配一个光谱数据列表的内存
	/// </summary>
	/// <para>分配的内存在使用完成后必须通过\ref SpectrumDataList_Del "SpectrumDataList_Del()"释放</para>
	/// <param name="pixelNum">每条光谱的像素数</param>
	/// <param name="size">列表长度</param>
	/// <returns>分配好的光谱数据列表</returns>
	ExternC IDEAOPTICS_DLL SpectrumDataClr* SpectrumDataList_New(int pixelNum, size_t size);
	/// <summary>
	/// 释放一个通过\ref SpectrumDataList_New "SpectrumDataList_New()"接口分配的光谱数据列表的内存
	/// </summary>
	/// <param name="spec">需要释放的光谱数据列表</param>
	/// <param name="size">列表长度</param>
	/// <returns>无</returns>
	ExternC IDEAOPTICS_DLL void SpectrumDataList_Del(SpectrumDataClr* spec, size_t size);

	/// <summary>
	/// 分配一个多通道光谱数据列表的内存
	/// </summary>
	/// <para>分配的内存在使用完成后必须通过\ref MultiChannelSpectrumDataList_Del "MultiChannelSpectrumDataList_Del()"释放</para>
	/// <param name="pixelNum">像素数</param>
	/// <param name="channelNum">通道数</param>
	/// <param name="size">列表长度</param>
	/// <returns>分配好的多通道光谱数据列表</returns>
	ExternC IDEAOPTICS_DLL SpectrumDataClr** MultiChannelSpectrumDataList_New(int pixelNum, size_t channelNum, size_t size);
	/// <summary>
	/// 释放一个通过\ref MultiChannelSpectrumDataList_New "MultiChannelSpectrumDataList_New()"接口分配的多通道光谱数据列表的内存
	/// </summary>
	/// <param name="spec">需要释放的列表</param>
	/// <param name="channelNum">通道数</param>
	/// <param name="size">列表长度</param>
	/// <returns>无</returns>
	ExternC IDEAOPTICS_DLL void MultiChannelSpectrumDataList_Del(SpectrumDataClr** spec, size_t channelNum, size_t size);

	/// <summary>
	/// 分配一个光谱仪连接信息的内存
	/// </summary>
	/// <para>分配的内存使用完成后必须通过\ref ConnectionInfo_Del "ConnectionInfo_Del()"释放</para>
	/// <param name="pcIp">上位机IP</param>
	/// <param name="pcPort">上位机端口</param>
	/// <param name="spIp">光谱仪IP</param>
	/// <param name="spPort">光谱仪端口</param>
	/// <returns>分配好的连接信息</returns>
	ExternC IDEAOPTICS_DLL ConnectionInfo* ConnectionInfo_New(const char* pcIp, int pcPort, const char* spIp, int spPort);
	/// <summary>
	/// 释放一个通过\ref ConnectionInfo_New "ConnectionInfo_New()"接口分配的光谱仪连接信息的内存
	/// </summary>
	/// <param name="info">需要释放的连接信息</param>
	/// <returns>无</returns>
	ExternC IDEAOPTICS_DLL void ConnectionInfo_Del(ConnectionInfo* info);

	/// <summary>
	/// 更新当前在线的通道信息列表
	/// </summary>
	/// <param name="pcIP">上位机IP，传入nullptr时，会遍历上位机的所有网卡</param>
	/// <param name="info">通道信息列表输出地址，可传入nullptr</param>
	/// <returns>通道信息列表长度</returns>
	ExternC IDEAOPTICS_DLL size_t UpdateDeviceList(const char* pcIP, ChannelStatus* info);
	/// <summary>
	/// 获取当前在线的通道信息列表
	/// </summary>
	/// <param name="info">通道信息列表输出地址，可传入nullptr</param>
	/// <returns>通道信息列表长度</returns>
	ExternC IDEAOPTICS_DLL size_t GetDeviceList(ChannelStatus* info);

	/// <summary>
	/// 通过序列号获取光谱仪对象
	/// </summary>
	/// <param name="snList">序列号列表</param>
	/// <param name="size">序列号列表长度</param>
	/// <param name="errMsg">错误信息输出地址(需要预先分配好内存)，可传入nullptr</param>
	/// <param name="errMsgSize">为错误信息分配的内存长度</param>
	/// <returns>成功: 光谱仪对象<br/>失败: nullptr</returns>
	ExternC IDEAOPTICS_DLL IMultiChannelSpectrometer* GetSpectrometerBySN(char** snList, size_t size, char* errMsg, size_t errMsgSize);
	/// <summary>
	/// 获取光谱仪对象
	/// </summary>
	/// <param name="info">连接信息列表</param>
	/// <param name="size">连接信息列表长度</param>
	/// <returns>成功: 光谱仪对象<br/>失败: nullptr</returns>
	ExternC IDEAOPTICS_DLL IMultiChannelSpectrometer* GetSpectrometer(ConnectionInfo** info, size_t size);
	/// <summary>
	/// 释放光谱仪对象
	/// </summary>
	/// <param name="dev">需要释放的光谱仪对象</param>
	/// <returns>无</returns>
	ExternC IDEAOPTICS_DLL void FreeSpectrometer(IMultiChannelSpectrometer* dev);
	/// <summary>
	/// 与光谱仪建立连接
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool Connect(IMultiChannelSpectrometer* dev);
	/// <summary>
	/// 断开光谱仪连接
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <returns>无</returns>
	ExternC IDEAOPTICS_DLL void Disconnect(IMultiChannelSpectrometer* dev);

	/// <summary>
	/// 注册各通道光谱推送事件的回调函数
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="callback">回调函数,参数分别为光谱仪对象,光谱数据列表(长度为通道数,每个通道的数据长度一定为像素数),通道数,用户数据</param>
	/// <param name="userData">用户数据</param>
	/// <returns>无</returns>
	ExternC IDEAOPTICS_DLL void RegisterPushedSpectrumOfEachChannelReceivedCallback(IMultiChannelSpectrometer* dev, void (*callback)(IMultiChannelSpectrometer*, SpectrumDataClr*, int, void*), void* userData);
	/// <summary>
	/// 注销各通道光谱推送事件的回调函数
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <returns>无</returns>
	ExternC IDEAOPTICS_DLL void UnregisterPushedSpectrumOfEachChannelReceivedCallback(IMultiChannelSpectrometer* dev);

	/// <summary>
	/// 注册单个通道光谱推送事件的回调函数
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="callback">回调函数,参数分别为光谱仪对象,光谱对应的通道序列号,光谱数据(数据长度一定为像素数),用户数据</param>
	/// <param name="userData"></param>
	/// <returns>无</returns>
	ExternC IDEAOPTICS_DLL void RegisterPushedSpectrumOfOneChannelReceivedCallback(IMultiChannelSpectrometer* dev, void (*callback)(IMultiChannelSpectrometer*, char*, SpectrumDataClr*, void*), void* userData);
	/// <summary>
	/// 注销单个通道光谱推送事件的回调函数
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <returns>无</returns>
	ExternC IDEAOPTICS_DLL void UnregisterPushedSpectrumOfOneChannelReceivedCallback(IMultiChannelSpectrometer* dev);

	/// <summary>
	/// 读取光谱仪各通道的序列号
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">序列号列表输出地址(需要预先分配好内存)</param>
	/// <param name="numOfChannels">为序列号列表分配的通道数</param>
	/// <param name="sizeOfEachSN">为序列号列表中每个序列号分配的长度</param>
	/// <returns>实际读取到通道数</returns>
	ExternC IDEAOPTICS_DLL int GetSerialNumber(IMultiChannelSpectrometer* dev, char** sn, size_t numOfChannels, size_t sizeOfEachSN);
	/// <summary>
	/// 读取光谱仪型号
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="name">型号字符串输出地址(需要预先分配好内存)</param>
	/// <param name="size">分配的内存长度</param>
	/// <returns>无</returns>
	ExternC IDEAOPTICS_DLL void GetTypeName(IMultiChannelSpectrometer* dev, char* name, size_t size);
	/// <summary>
	/// 获取单个通道的像素数
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <returns>像素数</returns>
	ExternC IDEAOPTICS_DLL int GetPixelNumberOfOneChannel(IMultiChannelSpectrometer* dev);
	/// <summary>
	/// 获取光谱仪最小积分时间(单位ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <returns>最小积分时间</returns>
	ExternC IDEAOPTICS_DLL double GetMinIntegrationTime(IMultiChannelSpectrometer* dev);
	/// <summary>
	/// 获取光谱仪最大积分时间
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <returns>最大积分时间</returns>
	ExternC IDEAOPTICS_DLL double GetMaxIntegrationTime(IMultiChannelSpectrometer* dev);
	/// <summary>
	/// 获取光谱仪各通道的波长数据
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="wavelength">波长数据列表输出地址(需要预先分配内存)</param>
	/// <param name="numOfChannels">波长数据列表分配的通道数</param>
	/// <param name="size">波长数据列表中每条波长数据分配的长度</param>
	/// <returns>成功:实际读取到通道数; 失败:-1</returns>
	ExternC IDEAOPTICS_DLL int GetWavelengthOfEachChannel(IMultiChannelSpectrometer* dev, double** wavelength, size_t numOfChannels, size_t size);
	/// <summary>
	/// 获取指定索引通道的波长数据
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="index">通道索引</param>
	/// <param name="wavelength">波长数据输出地址(需要预先分配内存, 一般长度等于像素数)</param>
	/// <param name="size">为波长数据分配的长度</param>
	/// <returns>成功:波长数据长度; 失败:-1</returns>
	ExternC IDEAOPTICS_DLL int GetWavelengthOfIndex(IMultiChannelSpectrometer* dev, int index, double* wavelength, size_t size);
	/// <summary>
	/// 获取指定序列号通道的波长数据
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">通道序列号</param>
	/// <param name="wavelength">波长数据输出地址(需要预先分配内存, 一般长度等于像素数)</param>
	/// <param name="size">为波长数据分配的长度</param>
	/// <returns>成功:波长数据长度; 失败:-1</returns>
	ExternC IDEAOPTICS_DLL int GetWavelengthOfSn(IMultiChannelSpectrometer* dev, const char* sn, double* wavelength, size_t size);
	/// <summary>
	/// 设置光谱仪积分时间(单位ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="intTime">积分时间</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetIntegrationTime(IMultiChannelSpectrometer* dev, double intTime);
	/// <summary>
	/// 设置指定索引通道的积分时间(ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="index">通道索引</param>
	/// <param name="intTime">积分时间</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetIntegrationTimeOfIndex(IMultiChannelSpectrometer* dev, int index, double intTime);
	/// <summary>
	/// 设置指定序列号通道的积分时间(ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">通道序列号</param>
	/// <param name="intTime">积分时间</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetIntegrationTimeOfSn(IMultiChannelSpectrometer* dev, const char* sn, double intTime);
	/// <summary>
	/// 读取全部通道的积分时间(ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="intTimes">积分时间列表输出地址(需要预先分配内存)</param>
	/// <param name="size">为积分时间列表分配的长度</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetIntegrationTime(IMultiChannelSpectrometer* dev, double* intTimes, size_t size);
	/// <summary>
	/// 读取单个通道的积分时间(ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="index">通道索引</param>
	/// <param name="intTime">积分时间输出引用</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetIntegrationTimeOfIndex(IMultiChannelSpectrometer* dev, int index, double& intTime);
	/// <summary>
	/// 读取单个通道的积分时间(ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">通道序列号</param>
	/// <param name="intTime">积分时间输出引用</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetIntegrationTimeOfSn(IMultiChannelSpectrometer* dev, const char* sn, double& intTime);
	/// <summary>
	/// 设置光谱仪触发模式
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="mode">触发模式</param>
	/// <param name="n">触发帧数(仅多帧触发时生效)</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetTriggerMode(IMultiChannelSpectrometer* dev, AcquisitionMode mode, uint16_t n);
	/// <summary>
	/// 设置单个通道的触发模式
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="index">通道索引</param>
	/// <param name="mode">触发模式</param>
	/// <param name="n">触发帧数(仅多帧触发时生效)</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetTriggerModeOfIndex(IMultiChannelSpectrometer* dev, int index, AcquisitionMode mode, uint16_t n);
	/// <summary>
	/// 设置单个通道的触发模式
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">通道序列号</param>
	/// <param name="mode">触发模式</param>
	/// <param name="n">触发帧数(仅多帧触发时生效)</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetTriggerModeOfSn(IMultiChannelSpectrometer* dev, const char* sn, AcquisitionMode mode, uint16_t n);
	/// <summary>
	/// 读取光谱仪触发模式
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="mode">触发模式输出地址(若不关心可传入nullptr)</param>
	/// <param name="n">触发帧数输出地址(若不关心可传入nullptr)</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetTriggerMode(IMultiChannelSpectrometer* dev, AcquisitionMode* mode, uint16_t* n);
	/// <summary>
	/// 读取单个通道的触发模式
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="index">通道索引</param>
	/// <param name="mode">触发模式输出地址(若不关心可传入nullptr)</param>
	/// <param name="n">触发帧数输出地址(若不关心可传入nullptr)</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetTriggerModeOfIndex(IMultiChannelSpectrometer* dev, int index, AcquisitionMode* mode, uint16_t* n);
	/// <summary>
	/// 读取单个通道的触发模式
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">通道序列号</param>
	/// <param name="mode">触发模式输出地址(若不关心可传入nullptr)</param>
	/// <param name="n">触发帧数输出地址(若不关心可传入nullptr)</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetTriggerModeOfSn(IMultiChannelSpectrometer* dev, const char* sn, AcquisitionMode* mode, uint16_t* n);

	/// <summary>
	/// 设置光谱仪触发开关
	/// </summary>
	/// <para>当光谱仪处于多帧触发模式下时, 可通过该接口控制光谱仪是否接收触发信号。一般不需要调用</para>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sw">开关状态</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetTriggerSwitch(IMultiChannelSpectrometer* dev, bool sw);
	/// <summary>
	/// 获取光谱仪触发开关
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sw">开关状态输出引用</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetTriggerSwitch(IMultiChannelSpectrometer* dev, bool& sw);
	/// <summary>
	/// 设置所有通道的触发延迟(ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="delay">触发延迟</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetTriggerDelay(IMultiChannelSpectrometer* dev, double delay);
	/// <summary>
	/// 设置单个通道的触发延迟(ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="index">通道索引</param>
	/// <param name="delay">触发延迟</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetTriggerDelayOfIndex(IMultiChannelSpectrometer* dev, int index, double delay);
	/// <summary>
	/// 设置单个通道的触发延迟(ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">通道序列号</param>
	/// <param name="delay">触发延迟</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetTriggerDelayOfSn(IMultiChannelSpectrometer* dev, const char* sn, double delay);
	/// <summary>
	/// 获取所有通道的触发延迟(ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="delays">触发延迟列表输出地址(需要预先分配内存)</param>
	/// <param name="size">为触发延迟列表分配的长度</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetTriggerDelay(IMultiChannelSpectrometer* dev, double* delays, size_t size);
	/// <summary>
	/// 获取单个通道的触发延迟(ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="index">通道索引</param>
	/// <param name="delay">触发延迟输出引用</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetTriggerDelayOfIndex(IMultiChannelSpectrometer* dev, int index, double& delay);
	/// <summary>
	/// 获取单个通道的触发延迟(ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">通道序列号</param>
	/// <param name="delay">触发延迟输出引用</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetTriggerDelayOfSn(IMultiChannelSpectrometer* dev, const char* sn, double& delay);
	/// <summary>
	/// 对所有通道进行触发复位(放弃当前正在执行的积分操作)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool TriggerReset(IMultiChannelSpectrometer* dev);
	/// <summary>
	/// 对指定索引通道进行触发复位(放弃当前正在执行的积分操作)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="index">通道索引</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool TriggerResetOfIndex(IMultiChannelSpectrometer* dev, int index);
	/// <summary>
	/// 指定序列号通道复位(放弃当前正在执行的积分操作)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">通道序列号</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool TriggerResetOfSn(IMultiChannelSpectrometer* dev, const char* sn);
	/// <summary>
	/// 对所有通道进行软件触发
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SoftTrigger(IMultiChannelSpectrometer* dev);
	/// <summary>
	/// 对指定索引通道进行软件触发
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="index">通道索引</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SoftTriggerOfIndex(IMultiChannelSpectrometer* dev, int index);
	/// <summary>
	/// 对指定序列号通道进行软件触发
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">通道序列号</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SoftTriggerOfSn(IMultiChannelSpectrometer* dev, const char* sn);

	/// <summary>
	/// 读取各通道的光谱数据
	/// </summary>
	/// <para>需要通过\ref SpectrumDataList_New "SpectrumDataList_New()"接口分配传入的光谱数据列表</para>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="spectrum">光谱数据列表输出地址</param>
	/// <param name="numOfChannels">为列表分配的通道数</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetSpectrumOfEachChannel(IMultiChannelSpectrometer* dev, SpectrumDataClr* spectrum, int numOfChannels);

	/// <summary>
	/// 开启光谱主动推送
	/// </summary>
	/// <para>开启主动推送后, 通过由\ref RegisterPushedSpectrumOfEachChannelReceivedCallback "RegisterPushedSpectrumOfEachChannelReceivedCallback()"接口注册的回调函数获取光谱数据</para>
	/// <para>开启主动推送后, 禁止调用除了停止推送外任何设置/获取光谱仪配置的接口(如积分时间和触发模式等), 避免与光谱数据上发产生冲突</para>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="enableStitching">是否启用拼谱(预留参数, 默认为false)</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool EnableSpectrumPushing(IMultiChannelSpectrometer* dev, bool enableStitching = false);
	/// <summary>
	/// 开启指定索引通道的光谱主动推送
	/// </summary>
	/// <para>开启主动推送后, 通过由\ref RegisterPushedSpectrumOfEachChannelReceivedCallback "RegisterPushedSpectrumOfOneChannelReceivedCallback()"接口注册的回调函数获取光谱数据</para>
	/// <para>开启主动推送后, 禁止调用除了停止推送外任何设置/获取光谱仪配置的接口(如积分时间和触发模式等), 避免与光谱数据上发产生冲突</para>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="index">通道索引</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool EnableSpectrumPushingOfIndex(IMultiChannelSpectrometer* dev, int index);
	/// <summary>
	/// 开启指定序列号通道的光谱主动推送
	/// </summary>
	/// <para>开启主动推送后, 通过由\ref RegisterPushedSpectrumOfEachChannelReceivedCallback "RegisterPushedSpectrumOfOneChannelReceivedCallback()"接口注册的回调函数获取光谱数据</para>
	/// <para>开启主动推送后, 禁止调用除了停止推送外任何设置/获取光谱仪配置的接口(如积分时间和触发模式等), 避免与光谱数据上发产生冲突</para>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">通道序列号</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool EnableSpectrumPushingOfSn(IMultiChannelSpectrometer* dev, const char* sn);
	/// <summary>
	/// 关闭光谱主动推送
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool DisableSpectrumPushing(IMultiChannelSpectrometer* dev);
	/// <summary>
	/// 关闭指定索引通道的光谱主动推送
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="index">通道索引</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool DisableSpectrumPushingOfIndex(IMultiChannelSpectrometer* dev, int index);
	/// <summary>
	/// 关闭指定序列号通道的光谱主动推送
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">通道序列号</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool DisableSpectrumPushingOfSn(IMultiChannelSpectrometer* dev, const char* sn);

	/// <summary>
	/// 设置光谱仪频闪模式
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="mode">频闪模式</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetStrobeOutMode(IMultiChannelSpectrometer* dev, StrobeMode mode);
	/// <summary>
	/// 获取光谱仪频闪模式
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="mode"></param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetStrobeOutMode(IMultiChannelSpectrometer* dev, StrobeMode& mode);
	/// <summary>
	/// 设置光谱仪频闪开关
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="onoff">频闪开关状态(true表示输出频闪信号)</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetStrobeSwitch(IMultiChannelSpectrometer* dev, bool onoff);
	/// <summary>
	/// 获取光谱仪频闪开关
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="onoff">频闪开关状态输出引用(true表示输出频闪信号)</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetStrobeSwitch(IMultiChannelSpectrometer* dev, bool& onoff);
	/// <summary>
	/// 设置光谱仪频闪延迟(单位ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="delayInMs">频闪延迟</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetStrobeDelay(IMultiChannelSpectrometer* dev, double delayInMs);
	/// <summary>
	/// 获取光谱仪频闪延迟(单位ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="delayInMs">频闪延迟输出引用</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetStrobeDelay(IMultiChannelSpectrometer* dev, double& delayInMs);
	/// <summary>
	/// 设置光谱仪频闪脉宽(单位ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="widthInMs">频闪脉宽</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetStrobeWidth(IMultiChannelSpectrometer* dev, double widthInMs);
	/// <summary>
	/// 获取光谱仪频闪脉宽(单位ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="widthInMs">频闪脉宽输出引用</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetStrobeWidth(IMultiChannelSpectrometer* dev, double& widthInMs);
	/// <summary>
	/// 设置光谱仪频闪间隔(单位ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="intervalInMs">频闪间隔</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetStrobeInterval(IMultiChannelSpectrometer* dev, double intervalInMs);
	/// <summary>
	/// 获取光谱仪频闪间隔(单位ms)
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="intervalInMs">频闪间隔输出引用</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetStrobeInterval(IMultiChannelSpectrometer* dev, double& intervalInMs);

	/// <summary>
	/// 设置光谱仪缓存功能模式
	/// </summary>
	/// <para>启用缓存功能后,采集到的光谱数据会存至硬件缓存区中,只能通过\ref GetBufferedSpectraOfEachChannel "GetBufferedSpectraOfEachChannel()"接口读出</para>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="enable">是否启用缓存功能</param>
	/// <param name="mode">缓存功能支持的触发模式</param>
	/// <param name="totalFrames">缓存区分配大小(单位为张, 最大85000张)</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetBufferMode(IMultiChannelSpectrometer* dev, bool enable, BufferTriggerMode mode, uint32_t totalFrames);
	/// <summary>
	/// 
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="enable">是否启用缓存功能输出地址(若不关心可传入nullptr)</param>
	/// <param name="mode">缓存功能支持的触发模式输出地址(若不关心可传入nullptr)</param>
	/// <param name="totalFrames">缓存区分配大小输出地址(单位为张, 若不关心可传入nullptr)</param>
	/// <param name="currentFrames">当前缓存区中已存入的光谱张数(若不关心可传入nullptr)</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetBufferMode(IMultiChannelSpectrometer* dev, bool* enable, BufferTriggerMode* mode, uint32_t* totalFrames, uint32_t* currentFrames);
	/// <summary>
	/// 读取指定地址范围内的缓存光谱
	/// </summary>
	/// <para>需要通过\ref MultiChannelSpectrumDataList_New "MultiChannelSpectrumDataList_New()"接口分配传入的光谱数据列表</para>
	/// <para>地址从1开始计数</para>
	/// <para>每次不得尝试读取超过1000张光谱数据,否则接口会返回false</para>
	/// <para>每张缓存谱读取耗时约为5ms</para>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="startAddress">起始地址</param>
	/// <param name="endAddress">结束地址</param>
	/// <param name="spectrumData">光谱数据列表</param>
	/// <param name="numOfChannels">为光谱数据列表分配的通道数</param>
	/// <param name="retryNum">出现丢帧时的重传尝试次数(默认为1,即不重传)</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetBufferedSpectraOfEachChannel(IMultiChannelSpectrometer* dev, int startAddress, int endAddress, SpectrumDataClr** spectrumData, int numOfChannels, int retryNum = 1);
	/// <summary>
	/// 强制停止缓存光谱读取
	/// </summary>
	/// <para>调用该接口后, \ref GetBufferedSpectraOfEachChannel "GetBufferedSpectraOfEachChannel()"会立即返回false</para>
	/// <param name="dev">光谱仪对象</param>
	/// <returns>无</returns>
	ExternC IDEAOPTICS_DLL void ForceStopGetBufferedSpectra(IMultiChannelSpectrometer* dev);
	/// <summary>
	/// 清除缓存区中的所有数据
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool ClearBuffer(IMultiChannelSpectrometer* dev);
	/// <summary>
	/// 设置光谱仪所有通道的可调增益
	/// </summary>
	/// <para>增益范围为1倍-6倍, 设置值超出该范围接口会返回false</para>
	/// <para>可调增益是有档位的，并非连续值。所以实际设置的值会跟输入有细微的差别</para>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="toFlash">是否写入闪存，若写入闪存，光谱仪掉电仍会保存可调增益设置</param>
	/// <param name="gain">增益值</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetSignalGain(IMultiChannelSpectrometer* dev, bool toFlash, double gain);
	/// <summary>
	/// 设置光谱仪指定索引的通道的可调增益
	/// </summary>
	/// <para>增益范围为1倍-6倍, 设置值超出该范围接口会返回false</para>
	/// <para>可调增益是有档位的，并非连续值。所以实际设置的值会跟输入有细微的差别</para>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="index">通道索引</param>
	/// <param name="toFlash">是否写入闪存，若写入闪存，光谱仪掉电仍会保存可调增益设置</param>
	/// <param name="gain">增益值</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetSignalGainOfIndex(IMultiChannelSpectrometer* dev, int index, bool toFlash, double gain);
	/// <summary>
	/// 设置光谱仪指定序列号的通道的可调增益
	/// </summary>
	/// <para>增益范围为1倍-6倍, 设置值超出该范围接口会返回false</para>
	/// <para>可调增益是有档位的，并非连续值。所以实际设置的值会跟输入有细微的差别</para>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">通道序列号</param>
	/// <param name="toFlash">是否写入闪存，若写入闪存，光谱仪掉电仍会保存可调增益设置</param>
	/// <param name="gain">增益值</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetSignalGainOfSn(IMultiChannelSpectrometer* dev, const char* sn, bool toFlash, double gain);
	/// <summary>
	/// 获取光谱仪各通道的可调增益
	/// </summary>
	/// <para>该接口应配合\ref SetSignalGain "SetSignalGain()"接口使用。如果单独设置过某一通道的增益，该接口返回的增益值可能不准确。</para>
	/// <para>可调增益是有档位的，并非连续值。所以使用该接口读出的值与设置的值会有细微的差别</para>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="fromFlash">是否从闪存读取增益</param>
	/// <param name="gains">增益值列表输出地址(需要预先分配内存)</param>
	/// <param name="size">为增益值列表分配的长度</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetSignalGain(IMultiChannelSpectrometer* dev, bool fromFlash, double* gains, size_t size);
	/// <summary>
	/// 获取光谱仪指定索引通道的可调增益
	/// </summary>
	/// <para>可调增益是有档位的，并非连续值。所以使用该接口读出的值与设置的值会有细微的差别</para>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="index">通道索引</param>
	/// <param name="fromFlash">是否从闪存读取增益</param>
	/// <param name="gain">增益值输出引用</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetSignalGainOfIndex(IMultiChannelSpectrometer* dev, int index, bool fromFlash, double& gain);
	/// <summary>
	/// 获取光谱仪指定序列号通道的可调增益
	/// </summary>
	/// <para>可调增益是有档位的，并非连续值。所以使用该接口读出的值与设置的值会有细微的差别</para>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">通道序列号</param>
	/// <param name="fromFlash">是否从闪存读取增益</param>
	/// <param name="gain">增益值输出引用</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetSignalGainOfSn(IMultiChannelSpectrometer* dev, const char* sn, bool fromFlash, double& gain);
	/// <summary>
	/// 获取光谱仪各通道的PCB温度（单位摄氏度）
	/// <para>该接口耗时约为2000ms</para>
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="temps">温度列表输出地址(需要预先分配内存)</param>
	/// <param name="size">为温度列表分配的长度</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetPcbTemperature(IMultiChannelSpectrometer* dev, double* temps, size_t size);
	/// <summary>
	/// 设置所有通道的平均次数
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="count">平均次数</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetAverage(IMultiChannelSpectrometer* dev, int count);
	/// <summary>
	/// 设置单个通道的平均次数
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="index">通道索引</param>
	/// <param name="count">平均次数</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetAverageOfIndex(IMultiChannelSpectrometer* dev, int index, int count);
	/// <summary>
	/// 设置单个通道的平均次数
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">通道序列号</param>
	/// <param name="count">平均次数</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool SetAverageOfSn(IMultiChannelSpectrometer* dev, const char* sn, int count);
	/// <summary>
	/// 获取所有通道的平均次数
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="counts">平均次数列表输出地址(需要预先分配内存)</param>
	/// <param name="size">为平均次数列表分配的长度</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetAverage(IMultiChannelSpectrometer* dev, int* counts, size_t size);
	/// <summary>
	/// 获取单个通道的平均次数
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="index">通道索引</param>
	/// <param name="count">平均次数输出引用</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetAverageOfIndex(IMultiChannelSpectrometer* dev, int index, int& count);
	/// <summary>
	/// 获取单个通道的平均次数
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="sn">通道序列号</param>
	/// <param name="count">平均次数输出引用</param>
	/// <returns>操作是否成功</returns>
	ExternC IDEAOPTICS_DLL bool GetAverageOfSn(IMultiChannelSpectrometer* dev, const char* sn, int& count);

	/// <summary>
	/// 获取上一个错误信息
	/// </summary>
	/// <param name="dev">光谱仪对象</param>
	/// <param name="msg">错误信息输出地址(需要预先分配内存)</param>
	/// <param name="size">为错误信息分配的长度</param>
	/// <returns>错误码</returns>
	ExternC IDEAOPTICS_DLL NetSpectrometerErrorCode GetSpectrometerError(IMultiChannelSpectrometer* dev, char* msg, size_t size);
}